﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OleDb;
using System.Configuration;

namespace WeakEndForum
{
    public partial class ArticleDetailed : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string getURIParam = "";
            if (Modules.isRequestedQueryStringValid("aID", "ID", "Actualite", out getURIParam))
            {
                OleDbConnection conn = new OleDbConnection(
                ConfigurationManager.ConnectionStrings[Constantes.DB_NAME].ConnectionString);
                conn.Open();
                OleDbCommand comm = new OleDbCommand("SELECT ID, Titre, Contenu, Date_publication, Auteur FROM Actualite WHERE ID = @aID;", conn);
                comm.Parameters.Add(new OleDbParameter("aID", Convert.ToInt32(getURIParam)) { OleDbType = OleDbType.Integer });
                OleDbDataReader dataReader = comm.ExecuteReader();
                Modules.generateNewsDetailed(dataReader, ref newsArticleDetailed);
                conn.Close();
            }
            else
            {
                Server.Transfer("Error404.aspx");
            }
        }
    }
}